package com.devops.admin.service.impl;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


/**
 * @Author: 牛亚杰
 * @Description:
 */
public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {

    /*public MyPage<T> pageNew(IPage<T> page, Wrapper<T> queryWrapper) {
        IPage<T> tiPage = this.baseMapper.selectPage(page, queryWrapper);
        MyPage<T> myPage = new MyPage();
        myPage.setList(tiPage.getRecords());
        myPage.setPageNum((int)tiPage.getCurrent());
        myPage.setPageSize((int)tiPage.getSize());
        myPage.setTotal(tiPage.getTotal());
        return myPage;
    }

    public MyPage<Map> pageMapsNew(IPage<T> page, Wrapper<T> queryWrapper) {
        IPage<Map<String, Object>> mapIPage = this.baseMapper.selectMapsPage(page, queryWrapper);
        MyPage<Map> myPage = new MyPage();
        myPage.setList((List)mapIPage.getRecords());
        myPage.setPageNum((int)mapIPage.getCurrent());
        myPage.setPageSize((int)mapIPage.getSize());
        myPage.setTotal(mapIPage.getTotal());
        return myPage;
    }

    public MyPage<T> getPageNew(Page<T> page){
        MyPage<T> myPage = new MyPage();
        myPage.setList(page.getRecords());
        myPage.setTotal(page.getTotal());
        myPage.setPageSize((int)page.getSize());
        myPage.setPageNum((int)page.getCurrent());
        return myPage;
    }

    public MyPage getPageNew(Integer pageSize,Integer currentPage,Integer total,List records){
        MyPage myPage = new MyPage();
        myPage.setList(records);
        myPage.setTotal(total);
        myPage.setPageSize(pageSize);
        myPage.setPageNum(currentPage);
        return myPage;
    }*/
}
